com.cete.dynamicpdf
Class Prepress



Example: The following example shows how to use Prepress class.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Label;
import com.cete.dynamicpdf.text.OpenTypeFont;
 
public class MyClass{
        public static void main(String args[]) {
        // Create a document and set it's properties
        Document document = new Document();
        document.setTitle( "PDF/X-1a Document" );
        document.setPdfVersion( PdfVersion.v1_4 );
        
        // Create a page to add to the document
        Page page = new Page( PageSize.LETTER, PageOrientation.PORTRAIT, 54.0f );
        
        document.setPdfXVersion( PdfXVersion.PDF_X_1a_2003 );
        document.getOutputIntents().add( OutputIntent.getUSWebCoatedSwop() );
        document.setTrapped( Trapped.FALSE );
        
        // Create a Label using a TrueType font and CMYK color
        String text = "PDF/X 1-a Document";
        OpenTypeFont trueTypeFont = new OpenTypeFont( "verdana.ttf" );
        Label label = new Label( text, 0, 0, 504, 100, trueTypeFont, 18, TextAlign.CENTER, CmykColor.getBlueViolet() );
        
        // Add label to page
        page.getElements().add( label );
        
        // Add page to document
        document.getPages().add( page );
        
        // Save the PDF document
        document.draw("[PhysicalPath]/MyDocument.pdf");
    }
 }